package com.ruoyi.report_hntjg.domain.vo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.common.utils.BigDecimalUtil;
import lombok.Data;

import java.math.BigDecimal;


/**
 * 钢筋位置及保护层厚度试验检测记录-详情视图对象 report_hntjg_gjbhcjlb_ba_detail
 *
 * @author tll
 * @date 2024-08-07
 */
@Data
@ExcelIgnoreUnannotated
public class ReportHntjgGjbhcjlbBaDetailVo {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @ExcelProperty(value = "id")
    private Long detailId;

    /**
     * 主表id
     */
    @ExcelProperty(value = "主表id")
    private Long excelId;

    /**
     * 备注
     */
    @ExcelProperty(value = "备注")
    private String remark;


    /**
     * 实测值1
     */
    @ExcelProperty(value = "实测值1")
    private BigDecimal shicz1;

    /**
     * 实测值2
     */
    @ExcelProperty(value = "实测值2")
    private BigDecimal shicz2;

    /**
     * 实测值平均值
     */
    private Double shiczPjz;
    /**
     * 类型 baohc 保护层 gangj 钢筋
     */
    @ExcelProperty(value = "类型")
    private String type;

    private Integer sort;
    /**
     * 行号默认一批行
     */
    @ExcelProperty(value = "行号默认一批行")
    private Long baRowNumber;

    public void setShicz1(BigDecimal shicz1) {
        this.shicz1 = BigDecimalUtil.stpTrailZero(shicz1);
        this.setShiczPjz();

    }
    public void setShicz2(BigDecimal shicz2) {
        this.shicz2 = BigDecimalUtil.stpTrailZero(shicz2);
        this.setShiczPjz();
    }

    public void setShiczPjz() {
        if (BigDecimalUtil.isNotEmpty(shicz1) && BigDecimalUtil.isNotEmpty(shicz2)) {
            this.shiczPjz = ((shicz1.doubleValue() + shicz2.doubleValue()) / 2);
        }

    }

    public ReportHntjgGjbhcjlbBaDetailVo(Long excelId, Long baRowNumber) {
        this.excelId = excelId;
        this.baRowNumber = baRowNumber;
    }

}
